import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import Login from './views/Login.vue'
import Useref from './views/Useref.vue'
import EventList from './views/EventList.vue'
import Main from './views/Main.vue'
Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '/',
      name: 'main',
      component: Main,
      children:[
        {
          path: '/',
          name: 'home',
          component: Home,
        },
        {
          path:'/eventlist',
          name:'eventlist',
          component:EventList
        },
        {
          path: '/useref',
          name: 'useref',
          component: Useref
        },
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
  ]
})
// router.beforeEach((to,from,next)=>{
//   if(!to.meta.isPublic && !localStorage.token){
//     return next('/login')
//   }
//   next()
// })
export default router
